

import Layout from "@/layout"; //养殖系统
export function transformRoutes(routes) {
    const _import = require("@/router/_import_" + process.env.NODE_ENV); // 获取组件的方法
    routes.forEach(route => {
        if (route.meta) {
            route.meta.auth = true
        } else {
            route.meta = {}
            route.meta.auth = true
        }
        if (route.component) {
            // Layout组件特殊处理
            if (route.component === "Layout") { //运营管理系统
                route.component = Layout;
            } else if (typeof (route.component) === 'string') {
                route.component = _import(route.component);
            }
        }
        if (route.children) {
            route.children = transformRoutes(route.children)
        }
    })
    return routes
}